package com.zhijian.medical.controller;

import com.zhijian.medical.entity.po.RoutineQcHandle;
import com.zhijian.medical.entity.vo.request.RoutineQcHandleSearchVo;
import com.zhijian.medical.entity.vo.response.RoutineSampleVo;
import com.zhijian.medical.service.RoutineQcHandleService;
import com.zhijian.response.annotation.Response;
import com.zhijian.util.page.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Controller
@Api(tags = "常规病理-剩余组织处理")
public class RoutineQcHandleController {

    @Autowired
    RoutineQcHandleService routineQcHandleService;

    /**
     * 剩余组织处理列表
     *
     * @param param
     * @return
     */
    @Response
    @PostMapping("/routine/qc/handle/page")
    @ApiOperation("常规病理-剩余组织列表")
    public Page<RoutineQcHandle> selectPage(@RequestBody RoutineQcHandleSearchVo param) {
        log.info("{} - {}| insert info", this.getClass().getSimpleName(), param);
        return routineQcHandleService.selectPage(param);
    }

    @Response
    @PutMapping("/routine/qc/handle/{id}")
    @ApiOperation("常规病理-处理剩余组织")
    public RoutineQcHandle addHandle(@PathVariable("id") Long id) {
        log.info("{} - {}| insert info", this.getClass().getSimpleName(), id);
        return routineQcHandleService.handleById(id);
    }

    @Response
    @PostMapping("/routine/qc/handle/{id}")
    @ApiOperation("常规病理-获取处理剩余组织详情")
    public Page<RoutineSampleVo> readHandleDetail(@PathVariable("id") Long id, @RequestBody RoutineQcHandleSearchVo param) {
        log.info("{} - {}| insert info", this.getClass().getSimpleName(), id);
        return routineQcHandleService.readQcDetail(id, param);
    }
}
